home *** CD-ROM | disk | FTP | other *** search
- /*************************************************************************************
- Scaling.h
-
- Scaling implements a standard 2D canvas to draw a set of TGraphics and tiles into.
- It also provides a set of globals that allow the sprite's location to be relative
- to a specific camera location.
-
- Author: Timothy Carroll
- Apple Developer Technical Support
- timc@apple.com
-
- Modification History:
-
- 8/15/96 TMC Initial Release
-
- Copyright © 1996 Apple Computer, Inc., All Rights Reserved
-
- You may incorporate this sample code into your applications without
- restriction, though the sample code has been provided "AS IS" and the
- responsibility for its operation is 100% yours. However, what you are
- not permitted to do is to redistribute the source as "DSC Sample Code"
- after having made changes. If you're going to re-distribute the source,
- we require that you make it clear in the source that the code was
- descended from Apple Sample Code, but that you've made changes.
-
- *************************************************************************************/
-
- #ifndef _SCALING_
- #define _SCALING_
-
- #include <QuickDraw.h>
-
- // We define all the world coordinate scaling information here, and also define functions
- // for choosing the drawing buffer and clipping to it. The drawing buffer will be used by
- // TGraphic and TTile objects and any other class of offscreen blitters we make in the future.
-
-
- // WorldRect32 is a rectangle in 16.16 fixed point coordinates. FixedPoint coordinates are
- // used for all coordinates in the game. Anything in world coordinates should be converted
- // to screen coordinates before being drawn.
- // This structure defines a rectangle in 16.16 fixed point coordinates -- these are used as
- // the world coordinates for the game, they must be translated into screen coordinates
- // before drawing can take place.
-
- struct WorldRect32
- {
- SInt32 top;
- SInt32 left;
- SInt32 bottom;
- SInt32 right;
- };
-
- // For the most part, we define a number of globals that can be read freely, but
- // the functions should be called whenever one of these globals needs to be updated.
- // This is because more than one global might need to be set, and the functions do the
- // right thing.
-
-
-
- extern SInt32 gWorldCoordX;
- extern SInt32 gWorldCoordY;
- extern Rect gClipRect;
- extern SInt32 gClipCenterX;
- extern SInt32 gClipCenterY;
-
- extern PixMapHandle gDestPixMap;
- extern PixMapHandle gBackPixMap;
- extern unsigned char *gDestBaseAddr;
- extern unsigned char *gBackBaseAddr;
- extern UInt32 gRowBytes;
-
- extern void SetDestinationBuffer(PixMapHandle inDestPixMap, PixMapHandle inBackPixMap);
- extern void SetBufferClip(Rect *inClipRect);
- extern void SetWorldOrigin (SInt32 x, SInt32 y);
-
- #endif // _SCALING_